package com.xn.app.muying.adpter;

import android.support.v4.view.PagerAdapter;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;

import com.xn.app.muying.R;

import java.util.ArrayList;

/**
 * Created by Administrator on 2016/10/10.
 */
public class HomeTopViewPagerAdapter extends PagerAdapter{
    private ArrayList<View> list = new ArrayList<>();
    public HomeTopViewPagerAdapter(ArrayList<View> list){
        this.list = list;
        Log.i("==========",list.toString());
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {

        return view == object;
    }


    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        View view = list.get(position);
        container.addView(view);
        return view;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(list.get(position));
    }
}
